package com.ytjj.qmyx.admin.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.annotation.OperLog;
import com.ytjj.qmyx.admin.constants.SysLogConstants;
import com.ytjj.qmyx.admin.service.ReturnRegisterNoteService;
import com.ytjj.qmyx.mall.model.ReturnRegisterNote;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 
 *
 * @Version: 1.0
 *
 * 原路登记小记
 */
@RestController
@RequestMapping("/returnRegisterNote")
public class ReturnRegisterNoteController {

    @Autowired
    private ReturnRegisterNoteService returnRegisterNoteService;

    @GetMapping("/list")
    @OperLog(operModule = "原路登记小记", operDesc = "小记列表", operType = SysLogConstants.OPERATION_SELECT)
    public CommonResult getNotes(@RequestParam Integer returnRegisterId) {
        return CommonResult.success(returnRegisterNoteService.getNotes(returnRegisterId));
    }

    @PostMapping("/insertNote")
    @OperLog(operModule = "原路登记小记", operDesc = "新增小记", operType = SysLogConstants.OPERATION_ADD)
    public CommonResult insertNote(@RequestBody ReturnRegisterNote returnRegisterNote) {
        Integer count = returnRegisterNoteService.insertNote(returnRegisterNote);
        if (count > 0) {
            return CommonResult.success(count);
        } else {
            return CommonResult.failed();
        }
    }

}
